#pragma once

#include "Mutex.h"

class CThread;

class IRunnable
{
public:
	virtual ~IRunnable(){}

	virtual void run(CThread * thread) = 0;
};

class CThread
{
public:
	CThread(void);
	virtual ~CThread(void);

	bool start(IRunnable * runnable);
	void join();

	bool quitRequested() const
	{
		return m_quitRequested;
	}

protected:
	static unsigned int WINAPI threadFunc(void * data);

private:
	HANDLE m_handle;
	IRunnable * m_runnable;
	bool m_quitRequested;
};

